/* Table 1: summary statistics */

libname edu '!userprofile\\Dropbox\Education\Replication\Data';

/* summary stats */
proc sql;
  create table temp as 
  select a.*, b.log_bachelor
  from edu.skew as a left join edu.enrolment as b
  on a.year = b.year_ending and a.major = b.majorcode;
quit;

data temp; set temp; 
  if major = 12 then delete;
  if major = 21 then delete;
run; 

proc sql;
  create table temp as 
  select a.*, b.annual_wage, b.tot_emp, b.delta_tot_emp
  from temp as a left join edu.wagesoc as b
  on a.year = b.year and a.major = b.major;
quit;

data temp; set temp; if major = . then delete; run;

proc sort data = temp; by major year; run;

data temp;
  set temp;
  by major year;
  
  bachelor = exp(log_bachelor);

  mktcap = exp(log_mktcape_major)/1000000;
  btm = exp(log_btme_major);
  age = exp(log_agee_major);

  rawannual_wage = exp(annual_wage);
  rawtot_emp = exp(tot_emp);

  net_newhires = rawtot_emp - lag(rawtot_emp);
  if first.major then net_newhires = .;
run;


data temp; set temp; if year<1966 then delete; run;

proc means data = temp median p25 p75 std n;
  var 
  bachelor
  skew1e_major
  ret50tb_10_major
  ret50t_10_major
  ret50b_10_major
  ravenskew1e_major
  tsmean5_major
  tsvol5_major

  mktcap
  btm
  age
  
  rawannual_wage
  delta_tot_emp
  net_newhires
;
run;
